<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>新增图书 - 图书管理系统</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="container mt-5">
    <div class="d-flex align-items-center mb-4">
        <button class="btn btn-outline-secondary me-3" onclick="window.location.href='index.html'">
            <i class="bi bi-arrow-left"></i> 返回列表
        </button>
        <h1>新增图书</h1>
    </div>

    <form id="addBookForm" class="w-75 mx-auto">
        <div class="mb-3">
            <label for="title" class="form-label">书名 <span class="text-danger">*</span></label>
            <input type="text" id="title" name="title" class="form-control" required>
        </div>

        <div class="mb-3">
            <label for="author" class="form-label">作者 <span class="text-danger">*</span></label>
            <input type="text" id="author" name="author" class="form-control" required>
        </div>

        <div class="mb-3">
            <label for="isbn" class="form-label">ISBN <span class="text-danger">*</span></label>
            <input type="text" id="isbn" name="isbn" class="form-control" required>
        </div>

        <div class="mb-3">
            <label for="category" class="form-label">分类</label>
            <input type="text" id="category" name="category" class="form-control">
        </div>

        <div class="row mb-3">
            <div class="col">
                <label for="totalCopies" class="form-label">总藏书量 <span class="text-danger">*</span></label>
                <input type="number" id="totalCopies" name="totalCopies" class="form-control" min="0" required>
            </div>
            <div class="col">
                <label for="availableCopies" class="form-label">可借数量 <span class="text-danger">*</span></label>
                <input type="number" id="availableCopies" name="availableCopies" class="form-control" min="0" required>
            </div>
        </div>

        <div class="mb-3">
            <label for="description" class="form-label">图书简介</label>
            <textarea id="description" name="description" class="form-control" rows="3"></textarea>
        </div>

        <div class="d-grid gap-2 d-md-flex justify-content-md-end">
            <button type="button" class="btn btn-secondary me-md-2" onclick="window.location.href='index.html'">取消</button>
            <button type="submit" class="btn btn-primary">提交</button>
        </div>
    </form>
</div>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css">
<script src="js/common.js"></script>
<script src="js/add-book.js"></script>
</body>
</html>